﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test_FinPlus
{
    using NUnit.Framework;

    [TestFixture]
    public class FinPlusTest
    {

        [Test]//EURDepoSwap spot5YearSwap
        public static void Swap_Test1()
        {
            //var test = "";

            //var ql = new ql();
            //var yc = ql.YieldCurve("EURDepoSwap", 38252, 2, "Depo,Rate,1,Weeks,0.0382;Depo,Rate,1,Months,0.0372;Depo,Rate,3,Months,0.0363;Depo,Rate,6,Months,0.0353;Depo,Rate,9,Months,0.0348;Depo,Rate,1,Years,0.0345;Swap,Rate,2,Years,0.037125;Swap,Rate,3,Years,0.0398;Swap,Rate,5,Years,0.0443;Swap,Rate,10,Years,0.05165;Swap,Rate,15,Years,0.055175", "Act/360", "Act/Act:ISDA", "TGT");
            //var swp = ql.VanillaSwapTrade("spot5YearSwap", "EURDepoFRASwap", 1000000, 38252, 40078, 0.04, "Payer", "EURDepoFutSwap", 0, "Annual", "Semiannual", "Unadjusted", "ModifiedFollowing", "Euro30/360", "Act/360", "TGT");
            //var el = ql.EngineLink("SwapEngine", "EURDepoSwap", "EURDepoSwap");
            //var res = ql.EngineValueTrade("SwapEngine", "spot5YearSwap", "NPV,fairSpread,fairRate");
            
            //Assert.AreEqual(res, test);
        }

        [Test]//EURDepoFRASwap spot5YearSwap
        public static void Swap_Test2()
        {
            //var test = "";

            //var ql = new ql();
            //var yc = ql.YieldCurve("EURDepoFRASwap", 38252, 2, "Depo,Rate,1,Weeks,0.0382;Depo,Rate,1,Months,0.0372;Depo,Rate,3,Months,0.0363;FRA,Rate,3,6,0.037125;FRA,Rate,6,9,0.037125;FRA,Rate,6,12,0.037125;Swap,Rate,2,Years,0.037125;Swap,Rate,3,Years,0.0398;Swap,Rate,5,Years,0.0443;Swap,Rate,10,Years,0.05165;Swap,Rate,15,Years,0.055175", "Act/360", "Act/Act:ISDA", "TGT");
            //var swp = ql.VanillaSwapTrade("spot5YearSwap", "EURDepoFRASwap", 1000000, 38252, 40078, 0.04, "Payer", "EURDepoFutSwap", 0, "Annual", "Semiannual", "Unadjusted", "ModifiedFollowing", "Euro30/360", "Act/360", "TGT");
            //var el = ql.EngineLink("SwapEngine", "EURDepoFRASwap", "EURDepoFRASwap");
            //var res = ql.EngineValueTrade("SwapEngine", "spot5YearSwap", "NPV,fairSpread,fairRate");

            //Assert.AreEqual(res, test);
        }

        [Test]//EURDepoFutSwap spot5YearSwap
        public static void Swap_Test3()
        {
            //var test = "tradeId,NPV,fairSpread,fairRate;spot5YearSwap,19049.2,-0.00418867,0.044296";

            //var ql = new ql();
            //var yc = ql.YieldCurve("EURDepoFutSwap", 38252, 2, "Depo,Rate,1,Weeks,0.0382;Depo,Rate,1,Months,0.0372;Fut,Real,1,IMM,96.2875;Fut,Real,2,IMM,96.7875;Fut,Real,3,IMM,96.9875;Fut,Real,4,IMM,96.6875;Fut,Real,5,IMM,96.4875;Fut,Real,6,IMM,96.3875;Fut,Real,7,IMM,96.2875;Fut,Real,8,IMM,96.0875;Swap,Rate,3,Years,0.0398;Swap,Rate,5,Years,0.0443;Swap,Rate,10,Years,0.05165;Swap,Rate,15,Years,0.055175", "Act/360", "Act/Act:ISDA", "TGT");
            //var swp = ql.VanillaSwapTrade("spot5YearSwap", "EURDepoFRASwap", 1000000, 38252, 40078, 0.04, "Payer", "EURDepoFutSwap", 0, "Annual", "Semiannual", "Unadjusted", "ModifiedFollowing", "Euro30/360", "Act/360", "TGT");
            //var el = ql.EngineLink("SwapEngine", "EURDepoFutSwap", "EURDepoFutSwap");
            //var res = ql.EngineValueTrade("SwapEngine", "spot5YearSwap", "NPV,fairSpread,fairRate");
            
            //Assert.AreEqual(res, test);
        }

        [Test]//EURDepoSwap oneYearForward5YearSwap
        public static void Swap_Test4()
        {
            //var test = "";

            //var ql = new ql();
            //var yc = ql.YieldCurve("EURDepoSwap", 38252, 2, "Depo,Rate,1,Weeks,0.0382;Depo,Rate,1,Months,0.0372;Depo,Rate,3,Months,0.0363;Depo,Rate,6,Months,0.0353;Depo,Rate,9,Months,0.0348;Depo,Rate,1,Years,0.0345;Swap,Rate,2,Years,0.037125;Swap,Rate,3,Years,0.0398;Swap,Rate,5,Years,0.0443;Swap,Rate,10,Years,0.05165;Swap,Rate,15,Years,0.055175", "Act/360", "Act/Act:ISDA", "TGT");
            //var swp = ql.VanillaSwapTrade("oneYearForward5YearSwap", "EURDepoFRASwap", 1000000.0, 38617, 40443, 0.04, "Payer", "EURDepoFutSwap", 0.0, "Annual", "Semiannual", "Unadjusted", "ModifiedFollowing", "Euro30/360", "Act/360", "TGT");
            //var el = ql.EngineLink("SwapEngine", "EURDepoSwap", "EURDepoSwap");
            //var res = ql.EngineValueTrade("SwapEngine", "oneYearForward5YearSwap", "NPV,fairSpread,fairRate");

            //Assert.AreEqual(res, test);
        }

        [Test]//EURDepoFRASwap oneYearForward5YearSwap
        public static void Swap_Test5()
        {
            //var test = "";

            //var ql = new ql();
            //var yc = ql.YieldCurve("EURDepoFRASwap", 38252, 2, "Depo,Rate,1,Weeks,0.0382;Depo,Rate,1,Months,0.0372;Depo,Rate,3,Months,0.0363;FRA,Rate,3,6,0.037125;FRA,Rate,6,9,0.037125;FRA,Rate,6,12,0.037125;Swap,Rate,2,Years,0.037125;Swap,Rate,3,Years,0.0398;Swap,Rate,5,Years,0.0443;Swap,Rate,10,Years,0.05165;Swap,Rate,15,Years,0.055175", "Act/360", "Act/Act:ISDA", "TGT");
            //var swp = ql.VanillaSwapTrade("oneYearForward5YearSwap", "EURDepoFRASwap", 1000000, 38617, 40443, 0.04, "Payer", "EURDepoFutSwap", 0, "Annual", "Semiannual", "Unadjusted", "ModifiedFollowing", "Euro30/360", "Act/360", "TGT");
            //var el = ql.EngineLink("SwapEngine", "EURDepoFRASwap", "EURDepoFRASwap");
            //var res = ql.EngineValueTrade("SwapEngine", "c", "NPV,fairSpread,fairRate");

            //Assert.AreEqual(res, test);
        }

        [Test]//EURDepoFutSwap oneYearForward5YearSwap
        public static void Swap_Test6()
        {
            //var test = "tradeId,NPV,fairSpread,fairRate;oneYearForward5YearSwap,40092.8,-0.00923433,0.0494846";

            //var ql = new ql();
            //var yc = ql.YieldCurve("EURDepoFutSwap", 38252, 2, "Depo,Rate,1,Weeks,0.0382;Depo,Rate,1,Months,0.0372;Fut,Real,1,IMM,96.2875;Fut,Real,2,IMM,96.7875;Fut,Real,3,IMM,96.9875;Fut,Real,4,IMM,96.6875;Fut,Real,5,IMM,96.4875;Fut,Real,6,IMM,96.3875;Fut,Real,7,IMM,96.2875;Fut,Real,8,IMM,96.0875;Swap,Rate,3,Years,0.0398;Swap,Rate,5,Years,0.0443;Swap,Rate,10,Years,0.05165;Swap,Rate,15,Years,0.055175", "Act/360", "Act/Act:ISDA", "TGT");
            //var swp = ql.VanillaSwapTrade("oneYearForward5YearSwap", "EURDepoFRASwap", 1000000, 38617, 40443, 0.04, "Payer", "EURDepoFutSwap", 0, "Annual", "Semiannual", "Unadjusted", "ModifiedFollowing", "Euro30/360", "Act/360", "TGT");
            //var el = ql.EngineLink("SwapEngine", "EURDepoFutSwap", "EURDepoFutSwap");
            //var res = ql.EngineValueTrade("SwapEngine", "oneYearForward5YearSwap", "NPV,fairSpread,fairRate");

            //Assert.AreEqual(res, test);
        }
    }
    
}
